package com.xxxy.jsq.action.type;

import com.xxxy.jsq.dao.TypeDao;
import com.xxxy.jsq.model.Type;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/deleteTypeServlet")
public class deleteTypeServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public deleteTypeServlet() {
        super();
    }
//
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        Type model = new Type();
        TypeDao dao = new TypeDao();
        Long cid=(Long.valueOf(request.getParameter("cid")));
        String flag=dao.deleteById(cid);
        PrintWriter out = response.getWriter();
        out.print(flag);
        out.flush();
        out.close();
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}